<template>
	<gui-page ref="guipage">
	<view slot="gBody" class="" style="">
		<view class="" style="bottom: 0;width: 100%;">
			<image src="http://boyaltd.oss-cn-hangzhou.aliyuncs.com/2022-09/29/dRcmwphpxVffZM1664446616220929.png" mode="widthFix" style="position: absolute;height: 100%;width: 100%;"></image>
		</view>
		
		<view class="heard gui-padding gui-color-white gui-relative" style="margin-top: 30rpx;height: 160rpx;width: 80%;padding-top: 60rpx;">
			<text class="gui-h2" style="margin-top: 40rpx;">集团公司领导信箱</text>
			<view class="" style="margin-top: 10rpx;">
				<text style="font-size: 20rpx;">LIUZHOU STEEL GROUP LEADER'S MAILBOX</text>
			</view>
		</view>
		
		<view class="gui-flex gui-text-center gui-relative" style="width: 100%;margin-top: 40rpx;justify-content: space-around;">
			<view @tap="change(0)" :class="current == 0 ? 'gui-bg-red' : 'gui-bg-gray'" style="width:30%;height: 60rpx;line-height: 60rpx;">
				<text>未审核</text>
			</view>
			<view @tap="change(1)" :class="current == 1 ? 'gui-bg-red' : 'gui-bg-gray'" style="width: 30%;height: 60rpx;line-height: 60rpx;margin-left: 20%;">
				<text>已审核</text>
			</view>
		</view>
		
		
		<view class="gui-relative" style="height: 70vh;overflow-y: scroll;">
			<view v-for="(item,index) in sh_list" @tap="to_sh_detail(item.id)" class="gui-flex" style="z-index: 99;" :key="index">
				<image src="http://boyaltd.oss-cn-hangzhou.aliyuncs.com/2022-09/28/iZI33phps5QW2p1664356528220928.png" mode="scaleToFill" style="width: 140rpx;height: 140rpx;"></image>
				<view class="gui-bg-white" style="height: 120rpx;width: 70%;margin-left: 20rpx;border-radius: 20rpx;padding-left: 20rpx;margin-top: 20rpx;">
					<view class="" style="margin-top: 20rpx;width: 100%;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
						<text>{{item.title}} : {{item.content}}</text>
					</view>
					<!-- <view class="gui-color-red" style="margin-top: 10rpx;">
						<text>当前环节 : {{item.this_process ? item.this_process.approver_name : '无审批'}}</text>
					</view> -->
				</view>
			</view>
		<view v-if="no_more" class="gui-text-center gui-color-white gui-relative">
			<text>无更多内容</text>
		</view>
		</view>
	</view>
	</gui-page>
</template>
<script>
export default {
	data() {
		return {
			user:[],
			sh_list:[],
            current: 0,
			no_more:false,
			pages:0
		}
	},
	// destroyed(){
	// 	console.log('114455');
	// },
	onLoad : function (option) {
		this.user=uni.getStorageSync("userInfo");
		console.log(this.user);
		console.log("option",option)
		// this.to_sh_detail()
	},
	onReady() {
		// this.real_login();
		this.sh_mail_list();
	},
	methods:{
		reget(){
			if(this.no_more){
				// this.$refs.guipage.stoploadmore();
				console.log("无更多");
			}else{
				console.log("加载更多");
				this.pages++;
				this.sh_mail_list(1);
			}
		},
		change(sta){
			//数据切换
			this.current = sta;
			this.sh_mail_list();
		},
		sh_mail_list(no_first){
			//获取审核列表
			let self = this;
			// self.$refs.guipageloading.open();
			// self.grace.post(self.apiUrl+"/mailbox/get_sh_list",{type:this.current,pages:this.pages},function(res){
				self.$boya.Post("/api/mailbox/get_sh_list",{type:this.current,pages:this.pages},function(res){
				if(res.data.sh_list.length == 0 || res.data.sh_list.length < 10){
					self.no_more = true;
				}
				if(res.code == 200){
					if(no_first){
						for(let i=0;i<res.data.sh_list.length;i++){
							self.sh_list.push(res.data.sh_list[i]);
						}
					}else{
						self.sh_list = res.data.sh_list;
					}
				}else{
					uni.showModal({
						title:'提示',content:res.data
					});
				}
			});
		},
		to_sh_detail(id){
			uni.navigateTo({
				url:'./mail_index?id=' + id
			});
			// console.log('to_sh_detail',id)
		}
	}
}
</script>

<style>
	page{
		height: 100%;
		/* background: url('http://boyaltd.oss-cn-hangzhou.aliyuncs.com/2022-09/29/dRcmwphpxVffZM1664446616220929.png') 100% 100%/100% 100%; */
		/* background: linear-gradient(0deg, rgba(237, 250, 250, 1) 0%, rgba(3, 29, 135, 1) 100%); */
	}
	.heard{
		background: url('https://img.js.design/assets/img/6332548debef9722cf5b62f9.png');
		background-size: 200rpx;
		background-repeat: no-repeat;
		background-position: right;
	}
	.this_bg{
		background-color: rgba(255, 141, 26, 1);
	}
	.defu_bg{
		background-color: rgba(29, 53, 148, 1);
	}
</style>
<style scoped>
	
</style>